package _23define;

import java.io.*;

public class Demo3 {
    public static void main(String[] args) throws IOException {
        decodeFile(new File("src/note/b.txt"), new File("src/note/a.txt"));
    }

    private static void decodeFile(File decodingFile, File  decodedFile) throws IOException {
        BufferedReader br=new BufferedReader(new FileReader(decodingFile));
        BufferedWriter ba=new BufferedWriter(new FileWriter(decodedFile));
        String line;
        while ((line=br.readLine())!=null){
            String newLine ="";
            for (int i = 0; i < line.length(); i++) {
                if ((line.charAt(i)>'0'&&line.charAt(i)<='9')||(line.charAt(i)>'a'&&line.charAt(i)<='z')||(line.charAt(i)>'A'&&line.charAt(i)<='Z')){
                    int a=line.charAt(i)-0;
                    String b= String.valueOf((char)(a-1));
                    newLine += b;
                }else if ((line.charAt(i)=='0')){
                    int a=line.charAt(i)-0;
                    String b=String.valueOf((char) (a+9));
                    newLine+=b;
                }else if ((line.charAt(i)=='a')||(line.charAt(i)=='A')){
                    int a=line.charAt(i)-0;
                    String b=String.valueOf((char) (a+23));
                    newLine+=b;
                }else {
                    newLine+=line.charAt(i);
                }
            }
            ba.write(newLine);
            ba.write("\t\r");
        }
        br.close();
        ba.flush();
        ba.close();
    }
}
